<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/


/* front start */
Route::get('/', "HomeController@index");
//Route::get('home/show/{id}/{level}', 'Root\NewsController@show');
Route::get('details/{id}', 'HomeController@details');
Route::get('news_list', 'HomeController@news_list');
Route::get('news/detail', 'HomeController@news_details');
Route::post('submit', 'HomeController@submit');

/* front end */


/* root start */
//需要加权限中间件的
Route::group(['prefix' => 'root', 'middleware' => 'root.check'], function () {
    Route::get('home', 'Root\HomeController@index');
    Route::get('news/destroy/{id}', 'Root\NewsController@destroy');
    Route::resource('news', 'Root\NewsController', ['except' => 'destroy']);
    Route::get('contacts/destroy/{id}', 'Root\ContactController@destroy');
    Route::resource('contacts', 'Root\ContactController', ['except' => 'destroy']);
});

Route::get('/root/login', 'Root\HomeController@login');
Route::post('/root/login', 'Root\UsersController@login');
Route::get('/root/loginout', 'Root\UsersController@loginOut');
/* root end */


/* test */


Route::get('test/{action}', function (App\Http\Controllers\TestController $index, $action) {
    return $index->$action();
});





